home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char rcsid[] = "$Header: screen.c,v 1.1 87/02/12 11:11:03 schoch Exp $";
- #endif
-
- #include "externs.h"
- #include <ctype.h>
-
- message(s, where)
- char *s;
- {
-
- waddstr(win[where], s);
- }
-
- mclear(where)
- {
- wclear(win[where]);
- }
-
- initscreen ()
- {
- int ww, ws1, ws2, ws3, ws;
- char *termtype, *getenv();
-
- termtype = getenv("TERM");
- vtterm = (!strncmp(termtype, "vt", 2) && !dumbterm);
- if (vtterm)
- COLS = 40;
- if (dumbterm)
- LINES = 10;
- initscr();
- noecho();
- crmode();
- if (SO == NIL || dumbterm)
- reversescr = FALSE;
- else
- reversescr = TRUE;
- if (vtterm) {
- sqheight = 3;
- sqwidth = 3;
- sqcolor [WHITE] = ' ';
- sqcolor [BLACK] = ' ';
- backupscreen = newwin (LINES, COLS, 0, 0);
- blankscreen = newwin (LINES, COLS, 0, 0);
- } else if (reversescr) {
- sqheight = 3;
- sqwidth = 5;
- sqcolor [WHITE] = ' ';
- sqcolor [BLACK] = ' ';
- } else {
- sqheight = 1;
- sqwidth = 2;
- sqcolor [WHITE] = '.';
- sqcolor [BLACK] = '*';
- }
- if (vtterm)
- ws = sqwidth * 8 + 1;
- else if (dumbterm)
- ws = sqwidth * 8 + 4;
- else
- ws = sqwidth * 8 + 10;
- ww = COLS - ws;
- if (dumbterm) {
- ww = ww / 3 - 1;
- ws1 = ws + 1;
- ws2 = ws1 + ww + 1;
- ws3 = ws2 + ww + 1;
- win [MYCOLOR] = subwin (stdscr, 1, 15 , 9, 3);
- win [TOMOVE] = subwin (stdscr, 1, ww , 1, ws3);
- win [CLOCK] = newwin (/*none*/1, 1 , 1, 1);
- win [CAPTURE] = subwin (stdscr, 1, ww , 3, ws3);
- win [PAWNTRIES] = subwin (stdscr, 1, ww , 4, ws3);
- win [CHECK] = subwin (stdscr, 3, ww , 5, ws3);
- win [PROMPT] = subwin (stdscr, 1, ww , 1, ws1);
- win [INPUT] = subwin (stdscr, 3, ww , 2, ws1);
- win [LEGAL] = subwin (stdscr, 1, ww , 5, ws1);
- win [MESSAGE] = subwin (stdscr, 4, ww , 1, ws2);
- win [OPPONENT] = subwin (stdscr, 5, ww , 5, ws2);
- backupwin [PROMPT] = subwin (stdscr, 1, ww , 1, ws1);
- backupwin [MESSAGE] = subwin (stdscr, 4, ww , 1, ws2);
- backupwin [INPUT] = subwin (stdscr, 3, ww , 2, ws1);
- } else {
- win [MYCOLOR] = subwin (stdscr, 1, ww , 1, ws);
- win [TOMOVE] = subwin (stdscr, 1, ww - 1, 3, ws);
- win [CLOCK] = subwin (stdscr, 1, 1, 3, COLS-1);
- win [CAPTURE] = subwin (stdscr, 1, ww , 5, ws);
- win [PAWNTRIES] = subwin (stdscr, 1, ww , 6, ws);
- win [CHECK] = subwin (stdscr, 3, ww , 7, ws);
- win [PROMPT] = subwin (stdscr, 1, ww , 10, ws);
- win [INPUT] = subwin (stdscr, 3, ww , 11, ws);
- win [LEGAL] = subwin (stdscr, 1, ww , 14, ws);
- win [MESSAGE] = subwin (stdscr, 4, ww , 15, ws);
- win [OPPONENT] = subwin (stdscr, 5, ww , 19, ws);
- scrollok (win [MESSAGE], TRUE);
- scrollok (win [INPUT], TRUE);
- backupwin [PROMPT] = subwin (stdscr, 1, ww , 10, ws);
- backupwin [MESSAGE] = subwin (stdscr, 4, ww , 15, ws);
- backupwin [INPUT] = subwin (stdscr, 3, ww , 11, ws);
- }
- }
-
- redraw_pos(pos)
- {
- waddch(square[pos], sqcolor[(pos + pos / 10) % 2]);
- }
-
- redraw_piece(pos)
- {
- if (whose[pos] == ourcolor)
- waddch(square[pos], symbol[occupant[pos]]);
- else
- waddch(square[pos], tolower(symbol[occupant[pos]]));
- }
-
- display_capture(color, piece)
- {
- }
-